<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
        <title>Overview Map Example</title>
        <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
        <link rel="stylesheet" href="style.css" type="text/css">
        <script src="../lib/OpenLayers.js" type="text/javascript"></script>
        <style>
        #map1 {
            width: 500px; 
            height: 300px;
            border: 1px solid gray;
        }
        #map2 {
            width: 500px; 
            height: 300px;
            border: 1px solid gray;
        }
        </style>
    </head>
    <body>
        <h1 id="title">Overview Map</h1>

        <div id="tags">
            overview, mapOptions, basic
        </div>
        <p id="shortdesc">
            Enable a small Overview Map that moves/interacts with your main map.
        </p>
        <div id="map1"></div>
        <p>The above map has an overview map control that is created with
        the default options.  Much like a regular map, the map contained by
        the overview map control defaults to a geographic projection.</p>
        <div id="map2"></div>
        <p>The second map has an overview map control that is created with
        non-default options.  In this case, the mapOptions property of the
        control has been set to use non-default projection related properties,
        and the layers property has been set to use a layer different from the main
        map. In addition, any other properties of the overview map control can be
        set in this way.</p>
        <script defer="defer" type="text/javascript">
        
        // set up some layers
        
        var ol = new OpenLayers.Layer.WMS(
            "OpenLayers WMS", 
            "http://vmap0.tiles.osgeo.org/wms/vmap0",
            {layers: 'basic'}
        );
        
        var jpl = new OpenLayers.Layer.WMS(
            "NASA Global Mosaic", 
            "http://t1.hypercube.telascience.org/cgi-bin/landsat7",
            {layers: "landsat7"}
        );
        
        // A clone of the above layer that we will use as overview for map2.
        // We need to clone jpl before the it gets added to a map, so the
        // clone can have its own maxExtent and maxResolution instead of
        // getting these settings initialized from map1.
        var jplOverview = jpl.clone();
        
        // A more detailled layer of Manhattan for map2
        var ny = new OpenLayers.Layer.WMS(
            "Manhattan", 
            "http://demo.opengeo.org/geoserver/wms",
            {
                layers: 'tiger-ny', 
                format: 'image/png'
            }
        );
        
        // create the top map (with default overview map control)
        var map1 = new OpenLayers.Map('map1');
        
        map1.addLayers([ol, jpl]);
        map1.addControl(new OpenLayers.Control.LayerSwitcher());
        
        // create an overview map control with the default options
        var overview1 = new OpenLayers.Control.OverviewMap({
            maximized: true
        });
        map1.addControl(overview1);
        
        map1.setCenter(new OpenLayers.LonLat(0, 0), 2);
        
        // create the bottom map (with advanced overview map control)
        var mapOptions = {
            maxExtent: new OpenLayers.Bounds(-8242894.927728, 4965204.031195,
                    -8227290.161511, 4994963.723637), 
            maxResolution: 116.24879860156216,
            projection: "EPSG:900913"
        };

        var map2 = new OpenLayers.Map('map2', mapOptions);
        
        map2.addLayers([ny]);
        
        // create an overview map control with non-default options
        var controlOptions = {
            maximized: true,
            mapOptions: OpenLayers.Util.extend(mapOptions, {
                maxResolution: 156543.0339,
                maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
                                     20037508.34, 20037508.34)
            }),
            layers: [jplOverview]
        };
        var overview2 = new OpenLayers.Control.OverviewMap(controlOptions);
        map2.addControl(overview2);
        
        map2.setCenter(new OpenLayers.LonLat(-8233165.3575055, 4980298.21113769), 3);
        
        </script>
    </body>
</html>
